ImagXpress 13 for .NET - User Guide > How To > Save an Image > Save Image to File |
Prior to saving an image, set the SaveOptions to provide specific instructions for saving the image. If no save options are specified, ImagXpress® uses default values when saving the image.
To save an image to a file, use the ImageX.Save methods. ImagXpress converts and compresses the image to the file format specified, and saves it to the target location. While ImagXpress is compressing and saving the image, the ImagXpress.ImageStatusEvent and ProgressEvent events provide information on the status of the operations.
ImagXpress supports saving image files to an FTP locations, as follows:
1. To specify passwords or proxy settings, set the Internet property within SaveOptions
2. Call one of the following:
Make sure that the String parameter specifies the full Internet path and file name. |
3. A copy of the ImageX image is stored in the target location.
ImagXpress supports the following multi-page image formats: TIFF, ICO and DCX. Multi-page images can be compressed and saved in both the Standard and Professional Editions.
C# Example |
Copy Code
|
---|---|
// This code demonstrates saving a multi-page image SaveOptions soOpts = new SaveOptions(); soOpts.Format = ImageXFormat.Tiff; soOpts.Tiff.Compression = Compression.Group4; soOpts.Tiff.MultiPage = true; ImgX.Image = ImageX.FromFile(strFileName); for (int i = 1; i <=ImgX.Image.PageCount; i++) { ImgX.Image.Page = i; ImgX.Image.Save("c:\\multipagetest.tif",Opts); } |
ImagXpress does not support saving to a multipage image at an HTTP or FTP location. |
When the SaveOptionsTiff.UseIFDOffset property is false (default), the image is appended to the end of the multi-page TIFF. Due to the linked format of TIFF, the software must traverse all the link pointers to identify the location to which the new page will be appended. The greater the number of pages in the target TIFF file, the longer the write process takes. (Typically, if the target file has more than 1000 pages, the write speed will degrade substantially.
Setting the SaveOptionsTiff.UseIFDOffset property to true specifies that the control should write the image to the location stored in the SaveOptionsTiff.IFDOffset property. This enables much faster writing of TIFF files with many pages because the software can seek to that location without traversing all previous pointer links. This process gives very predictable speeds in adding pages to a multi-page TIFF file.
If the file's IFDOffset ever became out of sync with the SaveOptionsTiff.IFDOffset property value, file corruption could occur. To protect the application from inadvertently corrupting a saved mutli-page file, the ImagXpress control takes the following measures:
No other operation with the TIFF file should be done during the looping of saving the pages with a fast TIFF write. It would be detrimental to call either the ImageX.ReadAllMetaData, ImageX.SaveAllMetaData, ImageX.CompactFile, ImageX.DeletePage, or ImageX.InsertPage methods in the middle of doing a fast TIFF write as they would definitely affect the IFD offsets in the file. |